<?php

class CSwitchable extends CWidget {
	
	public $items = array();
	
	public function run() {
		$this->registerScript();
$html = <<<EOD
	<h3>Horizontal</h3>
	<div id="slide1" class="slide-panel">
		<div>
			<img src="http://img.alimama.cn/bcrm/adboard/picture/2010-02-27/100227200543.jpg" />
			<img src="http://img.alimama.cn/bcrm/adboard/picture/2010-02-25/100225114729.gif" />
			<img src="http://img.alimama.cn/bcrm/adboard/picture/2010-02-26/100226150931.jpg" />
			<img src="http://img.alimama.cn/bcrm/adboard/picture/2010-02-25/100225173603.jpg" />
			<img src="http://img.alimama.cn/bcrm/adboard/picture/2010-02-22/100222173158.jpg" />
		</div>
	</div>
	<div id="trigger1" class="slide-trigger"><!-- 自动创建 triggers --></div>

EOD;
	
		echo $html;

$js = <<<EOD
<script type="text/javascript">
	$(function(){
		$("#trigger1").switchable("#slide1 > div > img", { effect: "scroll" });
	});
</script>
EOD;

		echo $js;
		
	}
	
	public function registerScript() {
		$cs = Yii::app()->clientScript;
		$am = Yii::app()->assetManager;
		
		$jsUrl = $am->publish(dirname(__FILE__).'/jquery.switchable[all].min.js');
		$cs->registerScriptFile($jsUrl);
	}

}

?>